package cn.schoolwow.quickserver.domain;

import cn.schoolwow.quickserver.response.HttpStatus;

import java.io.ByteArrayOutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 响应元数据
 */
public class HttpResponseMeta {
    /**
     * 协议版本
     */
    public String protocol = "HTTP/1.1";
    /**
     * 状态
     */
    public int status;
    /**
     * 消息
     */
    public String statusMessage;
    /**
     * http头部
     */
    public Map<String, List<String>> headers = new HashMap<>();
    /**
     * 编码格式
     */
    public String charset = "utf-8";
    /**
     * 编码格式
     */
    public String contentType;
    /**
     * body
     */
    public ByteArrayOutputStream bodyStream = new ByteArrayOutputStream();

    public void httpStatus(HttpStatus httpStatus) {
        this.status = httpStatus.status;
        this.statusMessage = httpStatus.statusMessage;
    }
}
